import os
from langchain.memory import ConversationSummaryBufferMemory
from langchain.chains import ConversationChain
from langchain.llms import OpenAI
os.environ["OPENAI_API_KEY"] = '读者申请的OpenAI API Key'
llm = OpenAI(temperature=0)
conversation_with_memory = ConversationChain(llm=llm, memory=ConversationSummaryBufferMemory(llm=llm, max_token_limit=60), verbose=True)
conversation_with_memory.predict(input="你好， 我是Mark")
conversation_with_memory.predict(input="我是一个人工智能爱好者，喜欢通过自媒体传播人工智能知识")
conversation_with_memory.predict(input="如今大模型发展得如火如荼，你能帮我制定一期视频节目的内容大纲吗")
conversation_with_memory.predict(input="你还可以给出更多选项吗")